import { FC, memo } from 'react';
import { Menu } from 'antd';
import { GroupPageModel } from '@/service/group';
import { MenuInfo } from 'rc-menu/es/interface';

interface IGroupMenuProps {
  groupModel: GroupPageModel | undefined;
  miners: string[];
  openGroupMoveModal: any;
  onClick?: (info: MenuInfo) => void;
}

const GroupMenu: FC<IGroupMenuProps> = (props) => {
  const { groupModel, miners, openGroupMoveModal } = props;

  return (
    <Menu selectable={false} onClick={props.onClick}>
      {groupModel?.groupList.map((group) => {
        return (
          <Menu.Item
            key={JSON.stringify({
              monitor: group.mid,
              gid: group.gid,
              name: group.name,
            })}
          >
            {group.name}
          </Menu.Item>
        );
      })}
    </Menu>
  );
};

export default memo(GroupMenu);
